<!DOCTYPE html>
<?php
session_start();
if(count($_POST)){
    if($_POST["username"]=="abc"&&$_POST["upwd"]=="123"){
        $_SESSION["login_id"]=110;
    }else{
        echo "用户名或者密码错误！";
    }
}
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        if(isset($_SESSION["login_id"])){
        ?>
           你已经登录<br/>
           <a href="logout.php">登出</a>
        <?php
        }else{
        ?>
           <h1>用户登录</h1>
            <form action="login.php" method="POST">
            用户名:<input type="text" name="username"/><br/>
            密  码：<input type="password" name="upwd" /><br/>
            <input type="submit" name="登录">          
        </form>
        <?php
        }
        ?>
        
    </body>
</html>
